package com.onlyMe.base
{
	import com.qb9.flashlib.logs.Logger;
	import com.qb9.flashlib.utils.ClassUtil;
	import com.qb9.flashlib.utils.StringUtil;
	
	import flash.utils.getQualifiedClassName;
	
	public final class LoggerWrapper
	{
		private static var logger:Logger;
		
		// To be used for other logs
		private static function get currentTime():String
		{
			return new Date().toUTCString().split(' ')[3];
		}
		
		private var prefix:String;
		
		public function LoggerWrapper(prefix:String)
		{
			this.prefix = StringUtil.capitalize(prefix);
		}
		
		public final function debug(args:Array):void
		{
			log('debug', args);
		}
		
		public final function info(args:Array):void
		{
			log('info', args);
		}
		
		public final function warning(args:Array):void
		{
			log('warning', args);
		}
		
		public final function error(args:Array):void
		{
			log('error', args);
		}
		
		private function log(method:String, args:Array):void
		{
			args.unshift(currentTime, '>', prefix, '>');
			
			logger = logger || Logger.getLogger('onlyMe');
			logger[method].apply(null, args);
		}
	}
}